package com.fansl.allround.open.api.feign.fallback;

import com.alibaba.fastjson.JSONObject;
import com.fansl.allround.open.api.entity.sms.SendSmsCodePO;
import com.fansl.allround.open.api.feign.RemoteJuHeService;
import com.fansl.allround.open.api.vo.NewsHeadlinesVO;
import com.fansl.allround.open.api.vo.SmsCodeVO;
import com.fansl.allround.open.api.vo.WeatherVO;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author fansl
 * @Description: TODO
 * @date 2019/9/10 18:59
 */
@Slf4j
@Component
public class RemoteJuHeServiceFallbackImpl implements RemoteJuHeService {
    @Setter
    private Throwable cause;

    /**
     * 聚合api-查询新闻头条
     *
     * @param newsType
     * @return
     */
    @Override
    public List<NewsHeadlinesVO> newsHeadlines(String newsType) {
        log.error("feign 查询新闻头条异常:{}", newsType, cause);
        return null;
    }

    /**
     * 聚合api-查询天气
     *
     * @param cityName
     * @return
     */
    @Override
    public WeatherVO weather(String cityName) {
        log.error("feign 查询天气异常:{}", cityName, cause);
        return null;
    }

    /**
     * 聚合api-发送手机验证码
     *
     * @param smsCodePO
     * @return
     */
    @Override
    public SmsCodeVO smsCode(SendSmsCodePO smsCodePO) {
        log.error("feign 发送手机验证码:{}", JSONObject.toJSONString(smsCodePO), cause);
        return null;
    }
}
